package com.lizemin.autoconfigure;

import com.lizemin.csrf.CsrfFilter;
import com.lizemin.csrf.CsrfProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author lzm
 * @date 2025/5/13 21:21
 * @description
 */
@Configuration
@ConditionalOnClass({CsrfFilter.class})
@EnableConfigurationProperties(CsrfProperties.class)
public class CsrfAutoConfiguration {

    @Bean
    public CsrfFilter csrfFilter(CsrfProperties csrfProperties) {
        CsrfFilter csrfFilter = new CsrfFilter();
        csrfFilter.setCsrfProperties(csrfProperties);
        return csrfFilter;
    }

}
